#pragma once
#ifndef skyFile_h__
#define skyFile_h__

#include "./skyAdapter.h"
#ifdef _SYMBIAN
#include "./symbian/symFile.h"
#else
#include "./windows/winFile.h"
#endif
#include "./symbian/symFile.h"
namespace Sky
{
	
	class OSDiskManager;
	typedef RefPtr<OSDiskManager> DiskManagerPtr;

	class File : public OSFile
	{
	public:
		File();
		 ~File();

		 enum OpenFlags {
			modeRead =          0x0000,
			modeWrite =         0x0001,
			modeReadWrite =     0x0002,
			modeCreate =		0x8000
		};

		enum SeekPosition { begin = 0x0, current = 0x1, end = 0x2 };

		TBool   open(const StringPtr& name,OpenFlags flag) ;

		virtual void    close() ;
		
		TInt read(u8* lpBuf, TUint nCount);

		TInt write(const u8* lpBuf, TUint nCount);

		TBool seek(TInt lOff, TUint nFrom);

		TUint getLength() const;

		TBool   seekToBegin() ;

		TBool   seekToEnd() ;

		static TBool  deleteFile(StringPtr& name);

		static TBool  deleteDirectory(StringPtr& dir);

		static TInt  getCurrentDiskFreeSpace();

		StringPtr   getName(){return _name;}
		TBool	    isOpened(){return _bOpen;}
	protected:
		TBool		_bOpen ;
		StringPtr	_name;
	};
	typedef RefPtr<File> FilePtr;

	class DiskManager : public OSDiskManager
	{
		FilePtr createFile(const StringPtr& name,File::OpenFlags flag = File::modeReadWrite);
		TBool	deleteFile(const StringPtr& name);
	};

	
}
#endif // skyFile_h__